package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishMapper {
    //插入菜品数据
    @AutoFill(value = OperationType.INSERT)
    void insert(Dish dish);
    Page<DishVO> pageQuery(DishPageQueryDTO dishPageQueryDTO);
    //删除菜品
    @Delete("delete from dish where id=#{id}")
    void delete(Long id);
    @Select("select * from dish where id=#{id}")
    Dish getId(Long id);
    @AutoFill(value = OperationType.UPDATE)
    void update(Dish dish);
    List list(Dish dish);
    @Select("select d.* from dish d join setmeal_dish sd on d.id = sd.setmeal_id where setmeal_id=#{setmealId}")
    List<Dish> getBySetmealId(Long stemelId);
}
